package edu.kit.csl.cratylus.extraction;

import java.util.List;

import edu.kit.csl.cratylus.datatypes.Candidate;
import edu.kit.csl.cratylus.datatypes.Sentence;
import edu.kit.csl.cratylus.datatypes.Word;

/**
 * This corpus updater replaces the target words in the corpus with the
 * found representative, without modifying adjacent target words. This is a
 * simplified version of the {@link AligningCorpusUpdater}.
 */
public class ReplacingCorpusUpdater implements CorpusUpdater {

	/* (non-Javadoc)
	 * @see CorpusUpdater#updateCorpus(Word, java.util.List)
	 */
	@Override
	public void updateCorpus(Word word, List<Candidate> candidates) {
		for (Candidate candidate : candidates) {
			Sentence trgtSen = candidate.getPair().getTargetSentence();
			trgtSen.set(candidate.getPosition(), word);
		}
	}
}
